import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Home from '@/views/Home.vue';
import Index from '@/views/Index.vue';
import Login from '@/views/Login.vue';
import UserCenter from '@/views/UserCenter.vue';
import Diseases from '@/views/Diseases.vue';
import Feedback from '../views/Feedback.vue';
import DiseasesDetails from '../views/DiseasesDetails.vue';

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'Index',
        component: Index,
    },
    {
        path: '/users/login',
        name: 'Login',
        component: Login,
    },
    {
        path: '/Home',
        name: 'Home',
        component: Home,
    },
    {
        path: '/UserCenter',
        name: 'UserCenter',
        component: UserCenter,
    },
    {
        path: '/Diseases',
        name: 'Diseases',
        component: Diseases,
    },
    {
        path: '/DiseasesDetails',
        name: 'DiseasesDetails',
        component: DiseasesDetails,
    },
    {
        path: '/Feedback',
        name: 'Feedback',
        component: Feedback,
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 在这里添加路由的导航守卫
router.beforeEach((to, from, next) => {
    console.log('Navigating to:', to.path);
    next();
});

export default router;
